package com.heima.comment.controller;


import com.heima.comment.service.IReplyCommentService;
import com.heima.model.comment.dtos.CommentDto;
import com.heima.model.comment.dtos.QueryCommentDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Xanny
 * @Data 2024/8/23 10:13
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/v1/comment_repay")
public class ReplyCommentController {
    @Autowired
    private IReplyCommentService replyCommentService;
    /**
     * 评论回复加载
     */
    @PostMapping("/load")
    public ResponseResult loadUserComment(@RequestBody QueryCommentDto dto) {
        return replyCommentService.loadUserComment(dto);
    }

    /**
     * 保存评论回复
     * @param dto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult saveUserComment(@RequestBody CommentDto dto) {
        return replyCommentService.saveUserComment(dto);
    }

    /**
     * 评论点赞
     * @param dto
     * @return
     */
    @PostMapping("/like")
    public ResponseResult likeUserComment(@RequestBody CommentDto dto) {
        return replyCommentService.likeUserComment(dto);
    }

}
